# dataset settings
dataset_type = "HollywoodDataset"
data_root = "data/HollywoodHeads/"
img_norm_cfg = dict(mean=[0, 0, 0], std=[1, 1, 1], to_rgb=True)
min_size = 16
train_pipeline = [
    dict(type="LoadImageFromFile", to_float32=True),
    dict(type="LoadAnnotations", with_bbox=True),
    dict(type="PhotoMetricDistortion",
         contrast_range=(0.8, 1.2),
         saturation_range=(0.8, 1.2),
         hue_delta=10),
    dict(type="Expand",
         mean=img_norm_cfg["mean"],
         to_rgb=img_norm_cfg["to_rgb"],
         ratio_range=(1, 2)),
    dict(type="MinIoURandomCrop",
         min_ious=(0.4, 0.5, 0.6, 0.7, 0.8, 0.9),
         min_crop_size=0.3),
    dict(type="Resize", img_scale=(608, 608), keep_ratio=True),
    dict(type="RandomFlip", flip_ratio=0.5),
    dict(type="Normalize", **img_norm_cfg),
    dict(type="Pad", size_divisor=32),
    dict(type="DefaultFormatBundle"),
    dict(type="Collect", keys=["img", "gt_bboxes", "gt_labels"]),
]
test_pipeline = [
    dict(type="LoadImageFromFile"),
    dict(
        type="MultiScaleFlipAug",
        img_scale=(608, 608),
        flip=False,
        transforms=[
            dict(type="Resize", keep_ratio=True),
            dict(type="RandomFlip"),
            dict(type="Normalize", **img_norm_cfg),
            dict(type="Pad", size_divisor=32),
            dict(type="ImageToTensor", keys=["img"]),
            dict(type="Collect", keys=["img"]),
        ],
    ),
]
data = dict(
    samples_per_gpu=6,
    workers_per_gpu=2,
    train=dict(type=dataset_type,
               ann_file=data_root + "ImageSets/Main/train.txt",
               img_prefix=data_root,
               pipeline=train_pipeline,
               min_size=min_size),
    val=dict(type=dataset_type,
             ann_file=data_root + "ImageSets/Main/val.txt",
             img_prefix=data_root,
             pipeline=test_pipeline,
             min_size=min_size),
    test=dict(type=dataset_type,
              ann_file=data_root + "ImageSets/Main/test.txt",
              img_prefix=data_root,
              pipeline=test_pipeline,
              min_size=min_size),
)
evaluation = dict(interval=1, metric="mAP")
